package com.woniu.util.controller;

import com.alibaba.fastjson.JSONObject;
import com.woniu.util.utils.MinioUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class MinioController {

    @Autowired
    private MinioUtils minioUtils;

    @PostMapping("/uploadimg")
    public JSONObject uploadimg(MultipartFile file ) {
        JSONObject test = null;
        try {
           test = minioUtils.uploadFile(file, "test");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return test;
    }
}